// app.js
App({
  onLaunch() {
    let than=this;
    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    staticUrl: 'https://6365-ceart-9gwyr-1301712380.tcb.qcloud.la/',
  },
   //渐变
  show: function (that, param, opacity, duration, step) {
    let select =wx.createAnimation({
      duration: duration,
      timingFunction: "ease-in-out"
    });
    select.opacity(opacity).step({
      duration: step
    });

    let json = '{"' + param + '":""}';
    json = JSON.parse(json);
    json[param] = select.export();
    that.setData(json);
  },
  //垂直滑动 渐入渐出
  slideupshow: function (that, param, px, opacity, duration, step) {
    let select = wx.createAnimation({
      duration: duration,
      timingFunction: "ease"
    });
    select.translateY(px).opacity(opacity).step({
      duration: step
    });
    let json = '{"' + param + '":""}';
    json = JSON.parse(json);
    json[param] = select.export();
    that.setData(json);
  },
  //平行滑动 渐入渐出
  sliderightshow: function (that, param, px, opacity, duration, step) {
    let select = wx.createAnimation({
      duration: duration,
      timingFunction: "ease"
    });
    select.translateX(px).opacity(opacity).step({
      duration: step
    });

    let json = '{"' + param + '":""}';
    json = JSON.parse(json);
    json[param] = select.export();
    that.setData(json);
  },
  scaleshow: function (that, param, px, opacity, step) {
    let scale= wx.createAnimation({
      duration: 2000,
      timingFunction: "ease-in-out"
    });
    scale.scaleX(px).opacity(opacity).step({
      duration: step
    });

    let json = '{"' + param + '":""}';
    json = JSON.parse(json);
    json[param] = scale.export();
    that.setData(json);
  },
  rotateshow: function (that, param, px, opacity) {
    let rotate = wx.createAnimation({
      duration: 2000,
      timingFunction: "ease-in-out"
    });
    rotate.rotateX(param).opacity(opacity).step();

    let json = '{"' + param + '":""}';
    json = JSON.parse(json);
    json[param] = rotate.export();
    that.setData(json);
  }
})
